package com.li.springswagger.controller;

import com.li.springswagger.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;


@ApiOperation("helloController")
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }

    //只要我们接口中，返回值存在实体类，就会被扫描到swagger中
    @PostMapping("/user")
    public User user(){
        return new User();
    }
    @ApiOperation("hello控制类")
    @GetMapping("/hello2")
    public String hello2(String name){
        return "hello"+name;
    }
    @ApiOperation("post测试类")
    @PostMapping("/post2")
    public String post2(@ApiParam("用户名") User user){
        return "hello"+user;
    }


}
